﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace QuizzMe.ValueConverters
{
    /// <summary>
    /// Convert a boolean to a Silverlight visibility
    /// </summary>
    public class BooleanToVisibilityValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool compareValue = (bool) value;
            bool compareTo = bool.Parse((string) parameter);
            return (compareValue == compareTo ? Visibility.Visible : Visibility.Collapsed);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
